home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / archiver / uucosr10.arc / UUCODER.C < prev    next >
C/C++ Source or Header  |  1991-05-31  |  3KB  |  128 lines

  1. /*
  2.  *  UUCODER
  3.  *  A GEM-based program to uuencode and uudecode files, i.e.,
  4.  *  transform binary files into mailable ASCII text and vice versa.
  5.  *  This program was constructed by gutting Dumas' UUE and UUD
  6.  *  to obtain the encoding routines, and constructing a GEM
  7.  *  interface. It expects that you'll compile it with Sozobon C
  8.  *  and GEMFAST; anything else may require some alterations.
  9.  *
  10.  *  This program is hereby placed in the public domain.
  11.  * 
  12.  *  -- Steve Yelvington <steve@thelake.mn.org> GEnie: S.YELVINGTO2 
  13.  *  
  14.  */
  15.  
  16. #include <stdio.h>
  17. #include <obdefs.h>
  18. #include <gemdefs.h>
  19. #include <osbind.h>
  20. #include <macros.h>
  21.  
  22. #include "uucoder.h" 
  23.  
  24. #define RESOURCE_FILE    "UUCODER.RSC"
  25.  
  26.  
  27. OBJECT *menubar;
  28.  
  29. /*
  30.  * Function: g_clrscr()
  31.  * Returns: void
  32.  * Description: Instructs GEM to redraw the Desktop workspace 
  33.  */
  34. void g_clrscr()
  35.     {
  36.     int x,y,w,h;
  37.     wind_get(0,WF_FULLXYWH,&x,&y,&w,&h);
  38.     form_dial(FMD_START,1,1,1,1,x,y,w,h);
  39.     form_dial(FMD_FINISH,1,1,1,1,x,y,w,h);
  40.     }
  41.  
  42.  
  43. /*
  44.  * Function: show_about()
  45.  * Returns: void
  46.  * Description: Shows the ABOUTBOX until timeout or mouse click
  47.  */
  48.  
  49. void show_about()
  50.     {
  51.     OBJECT *aboutbox;
  52.     int x,y,w,h,junk;
  53.     static long delay;
  54.     delay = 10*1000L;
  55.     rsrc_gaddr(R_TREE,ABOUTBOX, &aboutbox);
  56.     form_center(aboutbox, &x, &y, &w, &h);
  57.     form_dial(FMD_START,1,1,1,1,x,y,w,h);
  58.     form_dial(FMD_GROW,1,1,1,1,x,y,w,h);
  59.     objc_draw(aboutbox, 0, 10, x, y, w, h);
  60.  
  61.        /* Thanks to ramaer@cs.utwente.nl (Mark Ramaer) */
  62.     evnt_multi(MU_TIMER|MU_KEYBD|MU_BUTTON,
  63.         1, 1, 1, 
  64.         0,0,0,0,0,
  65.         0,0,0,0,0,
  66.         &junk,
  67.         loword(delay),hiword(delay),
  68.         &junk,&junk,        
  69.         &junk,&junk,        
  70.         &junk,
  71.         &junk);
  72.     form_dial(FMD_SHRINK,1,1,1,1,x,y,w,h);
  73.     form_dial(FMD_FINISH,1,1,1,1,x,y,w,h);
  74.     }
  75.  
  76.  
  77. /*
  78.  * function: main
  79.  * returns:  0
  80.  * description: Loads resource file, initializes GEM, calls 
  81.  *          external main_event().
  82.  */
  83.  
  84. main()
  85.     {
  86.     char *p; int i;
  87.     void g_clrscr(), show_about();
  88.     appl_init();
  89.     i = rsrc_load(RESOURCE_FILE);
  90.     if (!i)    /* try searching the path */
  91.         {
  92.         if (p=pfindfile(RESOURCE_FILE))
  93.             i = rsrc_load(p);
  94.         }
  95.     if (!i)    /* still no luck; bail out */
  96.         {
  97.         form_alert(1,"[1][Unable to load|resource file!][EXIT]");
  98.         appl_exit();
  99.         exit(-1);
  100.         }
  101.     graf_mouse(ARROW,NULL);
  102.     g_clrscr();
  103.     rsrc_gaddr(0,MENUBAR, &menubar);
  104.     menu_bar(menubar,TRUE);
  105.     show_about();
  106.     main_event();
  107.     menu_bar(menubar,FALSE);
  108.     g_clrscr();
  109.     rsrc_free();
  110.     appl_exit();
  111.     return 0; 
  112.     } 
  113.  
  114.  
  115. /*
  116.  * function: quit
  117.  * returns:  0
  118.  * description: quick exit in case of panic ... closes down GEM and exits. 
  119.  */
  120.  
  121. quit()    
  122.     {
  123.     menu_bar(menubar,FALSE);
  124.     g_clrscr();
  125.     appl_exit();
  126.     exit(0);
  127.     }
  128.